import { init } from "./js/index";

document.getElementById("printButton").addEventListener("click", () => {
  init(
    {
      width: "210mm",
      height: "297mm",
      header: "<h1 style='margin: 10px 0'>browser-table-print</h1>",
      body: document.getElementById("table").outerHTML,
      footer(pages) {
        return `<span>第${pages.pageNo}页/共${pages.total}页</span>`;
      },
      htmlPrintCss: "browser-table-print.css",
      style: "footer {text-align:center} th, th>div {white-space:nowrap}",
      padding: "0 20px",
    },
    ({ print }) => {
      print();
    }
  );
});
